<?php
/**
 * Created by allen.qiang
 * Date: 15-2-28
 * Time: 下午12:33
 * 移通短信功能完善(回调通知短信是否发送到用户)
 */
require('core/shop.php');

class sms_if{

    function sms_upd($url){
      global $G_SHOP;
      $strArray=explode('&',$url);
        foreach($strArray as $needArray){
            $str=explode('=',$needArray);
            if($str[0]=="spid" || $str[0]=="sppassword" ||  $str[0]=="mtstat"||  $str[0]=="mterrcode" || $str[0]=="mtmsgid"){
                $newArray[$str[0]]=$str[1];
            }
        }
        if($newArray['spid']=='5944'){
            $log_sms=new entity('log_sms');
            $log_sms->taskId=$newArray['mtmsgid'];
            $val=$G_SHOP->DBCA->fetch($log_sms);
            if($val==1){
                $log_sms->rt_mtstat=$newArray['mtstat'];
                $log_sms->rt_mterrcode=$newArray['mterrcode'];
                $log_sms->rt_timeStamp=date("Y-m-d H:i:s",time());
                $G_SHOP->DBCA->save($log_sms);
                return "更新成功";
            }else{
                return "找不到该数据";
            }

        }else{
            return "禁止访问";
        }

    }

}

//接口暂时关闭
die('500');

$sms_if=new sms_if();
$url=$_SERVER["QUERY_STRING"];
$sms_if->sms_upd($url);
